package dper.study.codes.concurrent.worker;

import org.apache.log4j.Logger;

/**
 * Created by leichen on 2017/3/20.
 * 很少使用此种形式
 */
public class SimpleThread extends Thread {
    Logger logger = Logger.getLogger(SimpleThread.class) ;

    private int ticketNum = 5  ;

    public void run(){
        synchronized (SimpleThread.class){
            if(ticketNum > 0)
                ticketNum -- ;
            logger.info("SimpleThread\t"+Thread.currentThread()+ "\t"+ticketNum) ;
        }
    }
}
